<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <title>燃气</title>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/pc/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/font_eolqem241z66flxr.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/news.css" media="all" />
    <script type="text/javascript" src="/pc/layout/js/jquery.min.js"></script>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search">
    <form class="layui-form" id="form" action="/admin/gas/index" method="get">
          @if($areaids ==="0")
      <div class="layui-input-inline" style="margin-top: 5px;margin-right: 15px;">
            <label class="layui-form-label" style="padding: 0;width: 66px;height: 38px;background: #E5E5E5;text-align: center;line-height: 38px;border-radius: 2px;">代理商</label>
            <div class="layui-input-block" style="width: 11em;margin-left: 66px">
                <select name="agent_id" lay-verify="required" lay-search="">
                    <option value="">请选择代理商</option>
                    @if(!empty($agentInfo))
                        @foreach($agentInfo as $v)
                            <option value="{{$v['id']}}" @if($v['id'] == $get['agent_id']) selected @endif>{{$v['name']}}</option>
                        @endforeach
                    @endif
                </select>
            </div>
        </div>
     @endif
         <div class="layui-input-inline" style="margin-top: 5px; margin-right: 15px;">        
            <label class="layui-form-label" style="padding: 0;width: 66px;height: 38px;background: #E5E5E5;text-align: center;line-height: 38px;border-radius: 2px;">区域</label>
           <input type="text" name="area" value="{{$get['area']}}" placeholder="请输入区域" class="layui-input search_input" style="width: 11em">
        </div>
         <div class="layui-input-inline" style="margin-top: 5px;margin-right: 15px;">
            <label class="layui-form-label" style="padding: 0;width: 66px;height: 38px;background: #E5E5E5;text-align: center;line-height: 38px;border-radius: 2px;">房间</label>
            <input type="text" name="room" value="{{$get['room']}}" placeholder="请输入房间" class="layui-input search_input" style="width: 11em">
        </div>
       <div class="layui-input-inline" style="margin-top: 5px;margin-right: 15px;">
            <label class="layui-form-label" style="padding: 0;width: 66px;height: 38px;background: #E5E5E5;text-align: center;line-height: 38px;border-radius: 2px;">DevEUI</label>
            <input type="text" name="dev" value="{{$get['dev']}}" placeholder="请输入DevEUI" class="layui-input search_input" style="width: 11em">
        </div>
       <div class="layui-input-inline" style="margin-top: 5px;margin-right: 15px;">
            <label class="layui-form-label" style="padding: 0;width: 66px;height: 38px;background: #E5E5E5;text-align: center;line-height: 38px;border-radius: 2px;">型号</label>
            <input type="text" name="model" value="{{$get['model']}}" placeholder="请输入型号" class="layui-input search_input" style="width: 11em">
        </div>
       <div class="layui-input-inline" style="">
        <a class="layui-btn search_btn" style="margin-top: 5px;" id="inqa">查询</a>
         <a class="layui-btn linksAdd_btn" style="background-color:#161917;margin-top: 5px;">添加</a>
           <a href="/admin/gas/upload" class="layui-btn linksAdd_down" style="background-color:#8DB6CD;margin-top: 5px;">下载</a>
        </div>
         <script>
            $('#inqa').click(function () {
                $('#form').submit();
            })
        </script>
    </form>
</blockquote>
<div class="layui-form links_list">
    <table class="layui-table">
        {{ csrf_field() }}
        <thead>
        <tr>
            <th >编号</th>
            <th>DevEUI</th>
            <th>型号</th>
            <th>区域</th>
            <th>房间</th>
            <th>全体负责人</th>
            <th>具体位置</th>
            <th>操作</th>
            <th>通知</th>
        </tr>
        </thead>
        <tbody class="links_content">
        @if(!empty($data))
            @foreach($data as $val)
                <tr id="gas_{{$val['id']}}">
                    <td>{{$val['num']}}</td>
                    <td>{{$val['DevEUI']}}</td>
                    <td>{{$val['model_name']}}</td>
                    <td>{{$val['area_name']}}</td>
                    <td>{{$val['room_name']}}</td>
                    <td>
                        @if(!empty($val['member']['area']))
                            区域:{{$val['member']['area']}}
                        @endif
                        @if(!empty($val['member']['room']))
                            房间:{{$val['member']['room']}}
                        @endif
                    </td>
                    <td>{{$val['loc']}}</td>
                    <td><a class="layui-btn layui-btn-mini" onclick="editGas({{$val['id']}})"><i class="iconfont icon-edit"></i> 编辑</a><a class="layui-btn layui-btn-danger layui-btn-mini" onclick="delGas({{$val['id']}})" data-id="1"><i class="layui-icon"></i> 删除</a></td>
                    <td>
                        <input type="checkbox" name="show" lay-skin="switch" lay-text="是|否" lay-filter="isShow" key="{{$val['id']}}" value="{{$val['status']}}" @if($val['status'] == 1) checked @endif>
                        <div class="layui-unselect layui-form-switch kai" lay-skin="_switch"><em>否</em><i></i>
                        </div>
                    </td>
                </tr>
            @endforeach
        @endif
        </tbody>
    </table>
</div>
@if(!null == $info)
    <div style="float:right;">
        {!! $info->appends($request)->render() !!}
    </div>
@endif

<script type="text/javascript" src="/pc/layui/layui.js"></script>
<script type="text/javascript" src="/pc/gas/js/gas.js"></script>
<script>
    //操作
    function editGas(id){  //编辑
        // layer.alert('您点击了友情链接编辑按钮，由于是纯静态页面，所以暂时不存在编辑内容，后期会添加，敬请谅解。。。',{icon:6, title:'友链编辑'});
        layui.layer.open({
            title : "编辑燃气",
            type: 2,
            content: '/admin/gas/edit?id='+id, //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
            area: ['45em', '45em']
        });
    }

    function delGas(id){  //删除
        layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
            $.ajax({
                url:'/admin/gas/destroy',
                type:'post',
                async:false,
                data:{
                    "_token": $("input[name=_token]").val(),
                    'id':id
                },
                dataType:'json',
                success:function (data) {
                    if(data.status == 1){
                        $('#gas_'+id).remove();
                    }
                }
            })
            layer.close(index);
        });
    }
</script>
</body>
</html>